<template>
    <div>
        <el-container>
            <el-main>
                <el-container class="parent-body">
                    <el-header class="content-header">
                        查看活动
                        <div class="return-style"><el-button icon="el-icon-arrow-left" @click.native="returnButton">返回</el-button></div>
                    </el-header>
                    <el-main class="info-main">
                        <el-row>
                            <el-col style="height: 100%;" :span="10" :offset="6">
                                <el-form ref="form" :rules="rules" :model="form" label-width="150px" disabled>
                                    <el-form-item label="活动名称：" prop="title">
                                        <el-input class="input-width" v-model="form.title"></el-input>
                                    </el-form-item>
                                    <el-form-item prop="startTime" label="开始时间：">
                                        <el-date-picker
                                                v-model="form.startTime"
                                                type="date"
                                                class="input-width"
                                                placeholder="请选择时间">
                                        </el-date-picker>
                                    </el-form-item>
                                    <el-form-item prop="endTime" label=" 到期时间：">
                                        <el-date-picker
                                                v-model="form.endTime"
                                                type="date"
                                                class="input-width"
                                                placeholder="请选择时间">
                                        </el-date-picker>
                                    </el-form-item>
                                    <el-form-item label="上线/下架：">
                                        <el-radio-group v-model="form.isShow">
                                            <el-radio :label="1">上线</el-radio>
                                            <el-radio :label="0">下架</el-radio>
                                        </el-radio-group>
                                    </el-form-item>
                                    <el-form-item prop="name" label="标题图片：">
                                    <img  :src="form.imgUrl" 
                                    class="avatar"
                                    />
                                    </el-form-item>
                                    <el-form-item label="活动描述：" prop="content" >
                                        <el-input class="input-width"
                                                type="textarea"
                                                :rows="4"
                                                placeholder="请输入内容"
                                                v-model="form.content">
                                        </el-input>
                                    </el-form-item>
                                   
                                </el-form>
                            </el-col>
                        </el-row>
                    </el-main>
                </el-container>
            </el-main>
        </el-container>
    </div>
</template>
<script>

import activityApi from "@/api/operate/acitivity"
    export default {
        data() {
            return {
                form:{
                 
                },
                rules: {
                    title: [
                        {required: true, message: '请输入活动名称', trigger: 'blur'}
                    ],
                },
                fileList:[],
            }
        },
        methods:{
            returnButton(){
                this.$router.replace({ path: "/operation/activity" });
            },
           
           
         

            // 获取基本数据
            intData(){
             var id=parseInt(this.$route.query.id);
                activityApi.listById(id).then(response=>{
               console.log(response);
               this.form=response.data.data;

                })
            },

            
        },
        created(){

            this.intData();

            }
       
    }
</script>
<style scoped>
    .content-header{
        position: relative;
    }
    .return-style{
        position: absolute;
        right:10px;
    }
    .input-width{
        width:250px;
    }
</style>